<?php
if (session_id() == "") session_start(); // Initialize Session data
ob_start(); // Turn on output buffering
?>
<?php include_once "ewcfg10.php" ?>
<?php include_once "ewmysql10.php" ?>
<?php include_once "phpfn10.php" ?>
<?php include_once "serviciodetalleinfo.php" ?>
<?php include_once "usuariosinfo.php" ?>
<?php include_once "userfn10.php" ?>
<?php

//
// Page class
//

$serviciodetalle_add = NULL; // Initialize page object first

class cserviciodetalle_add extends cserviciodetalle {

	// Page ID
	var $PageID = 'add';

	// Project ID
	var $ProjectID = "{1969EBBB-AC71-402B-89D8-7090C8C20C47}";

	// Table name
	var $TableName = 'serviciodetalle';

	// Page object name
	var $PageObjName = 'serviciodetalle_add';

	// Page name
	function PageName() {
		return ew_CurrentPage();
	}

	// Page URL
	function PageUrl() {
		$PageUrl = ew_CurrentPage() . "?";
		if ($this->UseTokenInUrl) $PageUrl .= "t=" . $this->TableVar . "&"; // Add page token
		return $PageUrl;
	}

	// Message
	function getMessage() {
		return @$_SESSION[EW_SESSION_MESSAGE];
	}

	function setMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_MESSAGE], $v);
	}

	function getFailureMessage() {
		return @$_SESSION[EW_SESSION_FAILURE_MESSAGE];
	}

	function setFailureMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_FAILURE_MESSAGE], $v);
	}

	function getSuccessMessage() {
		return @$_SESSION[EW_SESSION_SUCCESS_MESSAGE];
	}

	function setSuccessMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_SUCCESS_MESSAGE], $v);
	}

	function getWarningMessage() {
		return @$_SESSION[EW_SESSION_WARNING_MESSAGE];
	}

	function setWarningMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_WARNING_MESSAGE], $v);
	}

	// Show message
	function ShowMessage() {
		$hidden = FALSE;
		$html = "";

		// Message
		$sMessage = $this->getMessage();
		$this->Message_Showing($sMessage, "");
		if ($sMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sMessage;
			$html .= "<div class=\"alert alert-success ewSuccess\">" . $sMessage . "</div>";
			$_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message in Session
		}

		// Warning message
		$sWarningMessage = $this->getWarningMessage();
		$this->Message_Showing($sWarningMessage, "warning");
		if ($sWarningMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sWarningMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sWarningMessage;
			$html .= "<div class=\"alert alert-warning ewWarning\">" . $sWarningMessage . "</div>";
			$_SESSION[EW_SESSION_WARNING_MESSAGE] = ""; // Clear message in Session
		}

		// Success message
		$sSuccessMessage = $this->getSuccessMessage();
		$this->Message_Showing($sSuccessMessage, "success");
		if ($sSuccessMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sSuccessMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sSuccessMessage;
			$html .= "<div class=\"alert alert-success ewSuccess\">" . $sSuccessMessage . "</div>";
			$_SESSION[EW_SESSION_SUCCESS_MESSAGE] = ""; // Clear message in Session
		}

		// Failure message
		$sErrorMessage = $this->getFailureMessage();
		$this->Message_Showing($sErrorMessage, "failure");
		if ($sErrorMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sErrorMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sErrorMessage;
			$html .= "<div class=\"alert alert-error ewError\">" . $sErrorMessage . "</div>";
			$_SESSION[EW_SESSION_FAILURE_MESSAGE] = ""; // Clear message in Session
		}
		echo "<table class=\"ewStdTable\"><tr><td><div class=\"ewMessageDialog\"" . (($hidden) ? " style=\"display: none;\"" : "") . ">" . $html . "</div></td></tr></table>";
	}
	var $PageHeader;
	var $PageFooter;

	// Show Page Header
	function ShowPageHeader() {
		$sHeader = $this->PageHeader;
		$this->Page_DataRendering($sHeader);
		if ($sHeader <> "") { // Header exists, display
			echo "<p>" . $sHeader . "</p>";
		}
	}

	// Show Page Footer
	function ShowPageFooter() {
		$sFooter = $this->PageFooter;
		$this->Page_DataRendered($sFooter);
		if ($sFooter <> "") { // Footer exists, display
			echo "<p>" . $sFooter . "</p>";
		}
	}

	// Validate page request
	function IsPageRequest() {
		global $objForm;
		if ($this->UseTokenInUrl) {
			if ($objForm)
				return ($this->TableVar == $objForm->GetValue("t"));
			if (@$_GET["t"] <> "")
				return ($this->TableVar == $_GET["t"]);
		} else {
			return TRUE;
		}
	}

	//
	// Page class constructor
	//
	function __construct() {
		global $conn, $Language;
		$GLOBALS["Page"] = &$this;

		// Language object
		if (!isset($Language)) $Language = new cLanguage();

		// Parent constuctor
		parent::__construct();

		// Table object (serviciodetalle)
		if (!isset($GLOBALS["serviciodetalle"]) || get_class($GLOBALS["serviciodetalle"]) == "cserviciodetalle") {
			$GLOBALS["serviciodetalle"] = &$this;
			$GLOBALS["Table"] = &$GLOBALS["serviciodetalle"];
		}

		// Table object (usuarios)
		if (!isset($GLOBALS['usuarios'])) $GLOBALS['usuarios'] = new cusuarios();

		// Page ID
		if (!defined("EW_PAGE_ID"))
			define("EW_PAGE_ID", 'add', TRUE);

		// Table name (for backward compatibility)
		if (!defined("EW_TABLE_NAME"))
			define("EW_TABLE_NAME", 'serviciodetalle', TRUE);

		// Start timer
		if (!isset($GLOBALS["gTimer"])) $GLOBALS["gTimer"] = new cTimer();

		// Open connection
		if (!isset($conn)) $conn = ew_Connect();
	}

	// 
	//  Page_Init
	//
	function Page_Init() {
		global $gsExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm;

		// Security
		$Security = new cAdvancedSecurity();
		if (!$Security->IsLoggedIn()) $Security->AutoLogin();
		if (!$Security->IsLoggedIn()) {
			$Security->SaveLastUrl();
			$this->Page_Terminate("login.php");
		}
		$Security->TablePermission_Loading();
		$Security->LoadCurrentUserLevel($this->ProjectID . $this->TableName);
		$Security->TablePermission_Loaded();
		if (!$Security->IsLoggedIn()) {
			$Security->SaveLastUrl();
			$this->Page_Terminate("login.php");
		}
		if (!$Security->CanAdd()) {
			$Security->SaveLastUrl();
			$this->setFailureMessage($Language->Phrase("NoPermission")); // Set no permission
			$this->Page_Terminate("serviciodetallelist.php");
		}

		// Create form object
		$objForm = new cFormObj();
		$this->CurrentAction = (@$_GET["a"] <> "") ? $_GET["a"] : @$_POST["a_list"]; // Set up current action

		// Global Page Loading event (in userfn*.php)
		Page_Loading();

		// Page Load event
		$this->Page_Load();
	}

	//
	// Page_Terminate
	//
	function Page_Terminate($url = "") {
		global $conn;

		// Page Unload event
		$this->Page_Unload();

		// Global Page Unloaded event (in userfn*.php)
		Page_Unloaded();
		$this->Page_Redirecting($url);

		 // Close connection
		$conn->Close();

		// Go to URL if specified
		if ($url <> "") {
			if (!EW_DEBUG_ENABLED && ob_get_length())
				ob_end_clean();
			header("Location: " . $url);
		}
		exit();
	}
	var $DbMasterFilter = "";
	var $DbDetailFilter = "";
	var $Priv = 0;
	var $OldRecordset;
	var $CopyRecord;

	// 
	// Page main
	//
	function Page_Main() {
		global $objForm, $Language, $gsFormError;

		// Process form if post back
		if (@$_POST["a_add"] <> "") {
			$this->CurrentAction = $_POST["a_add"]; // Get form action
			$this->CopyRecord = $this->LoadOldRecord(); // Load old recordset
			$this->LoadFormValues(); // Load form values
		} else { // Not post back

			// Load key values from QueryString
			$this->CopyRecord = TRUE;
			if (@$_GET["ServicioId"] != "") {
				$this->ServicioId->setQueryStringValue($_GET["ServicioId"]);
				$this->setKey("ServicioId", $this->ServicioId->CurrentValue); // Set up key
			} else {
				$this->setKey("ServicioId", ""); // Clear key
				$this->CopyRecord = FALSE;
			}
			if ($this->CopyRecord) {
				$this->CurrentAction = "C"; // Copy record
			} else {
				$this->CurrentAction = "I"; // Display blank record
				$this->LoadDefaultValues(); // Load default values
			}
		}

		// Set up Breadcrumb
		$this->SetupBreadcrumb();

		// Validate form if post back
		if (@$_POST["a_add"] <> "") {
			if (!$this->ValidateForm()) {
				$this->CurrentAction = "I"; // Form error, reset action
				$this->EventCancelled = TRUE; // Event cancelled
				$this->RestoreFormValues(); // Restore form values
				$this->setFailureMessage($gsFormError);
			}
		}

		// Perform action based on action code
		switch ($this->CurrentAction) {
			case "I": // Blank record, no action required
				break;
			case "C": // Copy an existing record
				if (!$this->LoadRow()) { // Load record based on key
					if ($this->getFailureMessage() == "") $this->setFailureMessage($Language->Phrase("NoRecord")); // No record found
					$this->Page_Terminate("serviciodetallelist.php"); // No matching record, return to list
				}
				break;
			case "A": // Add new record
				$this->SendEmail = TRUE; // Send email on add success
				if ($this->AddRow($this->OldRecordset)) { // Add successful
					if ($this->getSuccessMessage() == "")
						$this->setSuccessMessage($Language->Phrase("AddSuccess")); // Set up success message
					$sReturnUrl = $this->getReturnUrl();
					if (ew_GetPageName($sReturnUrl) == "serviciodetalleview.php")
						$sReturnUrl = $this->GetViewUrl(); // View paging, return to view page with keyurl directly
					$this->Page_Terminate($sReturnUrl); // Clean up and return
				} else {
					$this->EventCancelled = TRUE; // Event cancelled
					$this->RestoreFormValues(); // Add failed, restore form values
				}
		}

		// Render row based on row type
		$this->RowType = EW_ROWTYPE_ADD;  // Render add type

		// Render row
		$this->ResetAttrs();
		$this->RenderRow();
	}

	// Get upload files
	function GetUploadFiles() {
		global $objForm;

		// Get upload data
	}

	// Load default values
	function LoadDefaultValues() {
		$this->ServicioOrden->CurrentValue = NULL;
		$this->ServicioOrden->OldValue = $this->ServicioOrden->CurrentValue;
		$this->ServicioServicio->CurrentValue = NULL;
		$this->ServicioServicio->OldValue = $this->ServicioServicio->CurrentValue;
		$this->ServicioSubTipo->CurrentValue = NULL;
		$this->ServicioSubTipo->OldValue = $this->ServicioSubTipo->CurrentValue;
		$this->ServicioSubTipoDetalle->CurrentValue = NULL;
		$this->ServicioSubTipoDetalle->OldValue = $this->ServicioSubTipoDetalle->CurrentValue;
		$this->ServicioTitulo->CurrentValue = NULL;
		$this->ServicioTitulo->OldValue = $this->ServicioTitulo->CurrentValue;
		$this->ServicioDondeRealizar->CurrentValue = NULL;
		$this->ServicioDondeRealizar->OldValue = $this->ServicioDondeRealizar->CurrentValue;
		$this->ServicioRequisitos->CurrentValue = NULL;
		$this->ServicioRequisitos->OldValue = $this->ServicioRequisitos->CurrentValue;
		$this->ServicioBeneficios->CurrentValue = NULL;
		$this->ServicioBeneficios->OldValue = $this->ServicioBeneficios->CurrentValue;
		$this->ServicioProcedimiento->CurrentValue = NULL;
		$this->ServicioProcedimiento->OldValue = $this->ServicioProcedimiento->CurrentValue;
		$this->ServicioObservaciones->CurrentValue = NULL;
		$this->ServicioObservaciones->OldValue = $this->ServicioObservaciones->CurrentValue;
		$this->ServicioActivo->CurrentValue = NULL;
		$this->ServicioActivo->OldValue = $this->ServicioActivo->CurrentValue;
		$this->ServicioUrl->CurrentValue = NULL;
		$this->ServicioUrl->OldValue = $this->ServicioUrl->CurrentValue;
	}

	// Load form values
	function LoadFormValues() {

		// Load from form
		global $objForm;
		if (!$this->ServicioOrden->FldIsDetailKey) {
			$this->ServicioOrden->setFormValue($objForm->GetValue("x_ServicioOrden"));
		}
		if (!$this->ServicioServicio->FldIsDetailKey) {
			$this->ServicioServicio->setFormValue($objForm->GetValue("x_ServicioServicio"));
		}
		if (!$this->ServicioSubTipo->FldIsDetailKey) {
			$this->ServicioSubTipo->setFormValue($objForm->GetValue("x_ServicioSubTipo"));
		}
		if (!$this->ServicioSubTipoDetalle->FldIsDetailKey) {
			$this->ServicioSubTipoDetalle->setFormValue($objForm->GetValue("x_ServicioSubTipoDetalle"));
		}
		if (!$this->ServicioTitulo->FldIsDetailKey) {
			$this->ServicioTitulo->setFormValue($objForm->GetValue("x_ServicioTitulo"));
		}
		if (!$this->ServicioDondeRealizar->FldIsDetailKey) {
			$this->ServicioDondeRealizar->setFormValue($objForm->GetValue("x_ServicioDondeRealizar"));
		}
		if (!$this->ServicioRequisitos->FldIsDetailKey) {
			$this->ServicioRequisitos->setFormValue($objForm->GetValue("x_ServicioRequisitos"));
		}
		if (!$this->ServicioBeneficios->FldIsDetailKey) {
			$this->ServicioBeneficios->setFormValue($objForm->GetValue("x_ServicioBeneficios"));
		}
		if (!$this->ServicioProcedimiento->FldIsDetailKey) {
			$this->ServicioProcedimiento->setFormValue($objForm->GetValue("x_ServicioProcedimiento"));
		}
		if (!$this->ServicioObservaciones->FldIsDetailKey) {
			$this->ServicioObservaciones->setFormValue($objForm->GetValue("x_ServicioObservaciones"));
		}
		if (!$this->ServicioActivo->FldIsDetailKey) {
			$this->ServicioActivo->setFormValue($objForm->GetValue("x_ServicioActivo"));
		}
		if (!$this->ServicioUrl->FldIsDetailKey) {
			$this->ServicioUrl->setFormValue($objForm->GetValue("x_ServicioUrl"));
		}
	}

	// Restore form values
	function RestoreFormValues() {
		global $objForm;
		$this->LoadOldRecord();
		$this->ServicioOrden->CurrentValue = $this->ServicioOrden->FormValue;
		$this->ServicioServicio->CurrentValue = $this->ServicioServicio->FormValue;
		$this->ServicioSubTipo->CurrentValue = $this->ServicioSubTipo->FormValue;
		$this->ServicioSubTipoDetalle->CurrentValue = $this->ServicioSubTipoDetalle->FormValue;
		$this->ServicioTitulo->CurrentValue = $this->ServicioTitulo->FormValue;
		$this->ServicioDondeRealizar->CurrentValue = $this->ServicioDondeRealizar->FormValue;
		$this->ServicioRequisitos->CurrentValue = $this->ServicioRequisitos->FormValue;
		$this->ServicioBeneficios->CurrentValue = $this->ServicioBeneficios->FormValue;
		$this->ServicioProcedimiento->CurrentValue = $this->ServicioProcedimiento->FormValue;
		$this->ServicioObservaciones->CurrentValue = $this->ServicioObservaciones->FormValue;
		$this->ServicioActivo->CurrentValue = $this->ServicioActivo->FormValue;
		$this->ServicioUrl->CurrentValue = $this->ServicioUrl->FormValue;
	}

	// Load row based on key values
	function LoadRow() {
		global $conn, $Security, $Language;
		$sFilter = $this->KeyFilter();

		// Call Row Selecting event
		$this->Row_Selecting($sFilter);

		// Load SQL based on filter
		$this->CurrentFilter = $sFilter;
		$sSql = $this->SQL();
		$res = FALSE;
		$rs = ew_LoadRecordset($sSql);
		if ($rs && !$rs->EOF) {
			$res = TRUE;
			$this->LoadRowValues($rs); // Load row values
			$rs->Close();
		}
		return $res;
	}

	// Load row values from recordset
	function LoadRowValues(&$rs) {
		global $conn;
		if (!$rs || $rs->EOF) return;

		// Call Row Selected event
		$row = &$rs->fields;
		$this->Row_Selected($row);
		$this->ServicioId->setDbValue($rs->fields('ServicioId'));
		$this->ServicioOrden->setDbValue($rs->fields('ServicioOrden'));
		$this->ServicioServicio->setDbValue($rs->fields('ServicioServicio'));
		$this->ServicioSubTipo->setDbValue($rs->fields('ServicioSubTipo'));
		$this->ServicioSubTipoDetalle->setDbValue($rs->fields('ServicioSubTipoDetalle'));
		$this->ServicioTitulo->setDbValue($rs->fields('ServicioTitulo'));
		$this->ServicioDondeRealizar->setDbValue($rs->fields('ServicioDondeRealizar'));
		$this->ServicioRequisitos->setDbValue($rs->fields('ServicioRequisitos'));
		$this->ServicioBeneficios->setDbValue($rs->fields('ServicioBeneficios'));
		$this->ServicioProcedimiento->setDbValue($rs->fields('ServicioProcedimiento'));
		$this->ServicioObservaciones->setDbValue($rs->fields('ServicioObservaciones'));
		$this->ServicioActivo->setDbValue($rs->fields('ServicioActivo'));
		$this->ServicioUrl->setDbValue($rs->fields('ServicioUrl'));
	}

	// Load DbValue from recordset
	function LoadDbValues(&$rs) {
		if (!$rs || !is_array($rs) && $rs->EOF) return;
		$row = is_array($rs) ? $rs : $rs->fields;
		$this->ServicioId->DbValue = $row['ServicioId'];
		$this->ServicioOrden->DbValue = $row['ServicioOrden'];
		$this->ServicioServicio->DbValue = $row['ServicioServicio'];
		$this->ServicioSubTipo->DbValue = $row['ServicioSubTipo'];
		$this->ServicioSubTipoDetalle->DbValue = $row['ServicioSubTipoDetalle'];
		$this->ServicioTitulo->DbValue = $row['ServicioTitulo'];
		$this->ServicioDondeRealizar->DbValue = $row['ServicioDondeRealizar'];
		$this->ServicioRequisitos->DbValue = $row['ServicioRequisitos'];
		$this->ServicioBeneficios->DbValue = $row['ServicioBeneficios'];
		$this->ServicioProcedimiento->DbValue = $row['ServicioProcedimiento'];
		$this->ServicioObservaciones->DbValue = $row['ServicioObservaciones'];
		$this->ServicioActivo->DbValue = $row['ServicioActivo'];
		$this->ServicioUrl->DbValue = $row['ServicioUrl'];
	}

	// Load old record
	function LoadOldRecord() {

		// Load key values from Session
		$bValidKey = TRUE;
		if (strval($this->getKey("ServicioId")) <> "")
			$this->ServicioId->CurrentValue = $this->getKey("ServicioId"); // ServicioId
		else
			$bValidKey = FALSE;

		// Load old recordset
		if ($bValidKey) {
			$this->CurrentFilter = $this->KeyFilter();
			$sSql = $this->SQL();
			$this->OldRecordset = ew_LoadRecordset($sSql);
			$this->LoadRowValues($this->OldRecordset); // Load row values
		} else {
			$this->OldRecordset = NULL;
		}
		return $bValidKey;
	}

	// Render row values based on field settings
	function RenderRow() {
		global $conn, $Security, $Language;
		global $gsLanguage;

		// Initialize URLs
		// Call Row_Rendering event

		$this->Row_Rendering();

		// Common render codes for all row types
		// ServicioId
		// ServicioOrden
		// ServicioServicio
		// ServicioSubTipo
		// ServicioSubTipoDetalle
		// ServicioTitulo
		// ServicioDondeRealizar
		// ServicioRequisitos
		// ServicioBeneficios
		// ServicioProcedimiento
		// ServicioObservaciones
		// ServicioActivo
		// ServicioUrl

		if ($this->RowType == EW_ROWTYPE_VIEW) { // View row

			// ServicioId
			$this->ServicioId->ViewValue = $this->ServicioId->CurrentValue;
			$this->ServicioId->ViewCustomAttributes = "";

			// ServicioOrden
			$this->ServicioOrden->ViewValue = $this->ServicioOrden->CurrentValue;
			$this->ServicioOrden->ViewCustomAttributes = "";

			// ServicioServicio
			if (strval($this->ServicioServicio->CurrentValue) <> "") {
				$sFilterWrk = "`ServicioId`" . ew_SearchString("=", $this->ServicioServicio->CurrentValue, EW_DATATYPE_NUMBER);
			$sSqlWrk = "SELECT `ServicioId`, `ServicioNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `servicios`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				ew_AddFilter($sWhereWrk, $sFilterWrk);
			}

			// Call Lookup selecting
			$this->Lookup_Selecting($this->ServicioServicio, $sWhereWrk);
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$this->ServicioServicio->ViewValue = $rswrk->fields('DispFld');
					$rswrk->Close();
				} else {
					$this->ServicioServicio->ViewValue = $this->ServicioServicio->CurrentValue;
				}
			} else {
				$this->ServicioServicio->ViewValue = NULL;
			}
			$this->ServicioServicio->ViewCustomAttributes = "";

			// ServicioSubTipo
			if (strval($this->ServicioSubTipo->CurrentValue) <> "") {
				$sFilterWrk = "`SubTipoId`" . ew_SearchString("=", $this->ServicioSubTipo->CurrentValue, EW_DATATYPE_NUMBER);
			$sSqlWrk = "SELECT `SubTipoId`, `SubTipoNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `subtiposervicios`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				ew_AddFilter($sWhereWrk, $sFilterWrk);
			}

			// Call Lookup selecting
			$this->Lookup_Selecting($this->ServicioSubTipo, $sWhereWrk);
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$this->ServicioSubTipo->ViewValue = $rswrk->fields('DispFld');
					$rswrk->Close();
				} else {
					$this->ServicioSubTipo->ViewValue = $this->ServicioSubTipo->CurrentValue;
				}
			} else {
				$this->ServicioSubTipo->ViewValue = NULL;
			}
			$this->ServicioSubTipo->ViewCustomAttributes = "";

			// ServicioSubTipoDetalle
			if (strval($this->ServicioSubTipoDetalle->CurrentValue) <> "") {
				$sFilterWrk = "`SubTipoDetalleId`" . ew_SearchString("=", $this->ServicioSubTipoDetalle->CurrentValue, EW_DATATYPE_NUMBER);
			$sSqlWrk = "SELECT `SubTipoDetalleId`, `SubTipoNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `subtipodetalles`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				ew_AddFilter($sWhereWrk, $sFilterWrk);
			}

			// Call Lookup selecting
			$this->Lookup_Selecting($this->ServicioSubTipoDetalle, $sWhereWrk);
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$this->ServicioSubTipoDetalle->ViewValue = $rswrk->fields('DispFld');
					$rswrk->Close();
				} else {
					$this->ServicioSubTipoDetalle->ViewValue = $this->ServicioSubTipoDetalle->CurrentValue;
				}
			} else {
				$this->ServicioSubTipoDetalle->ViewValue = NULL;
			}
			$this->ServicioSubTipoDetalle->ViewCustomAttributes = "";

			// ServicioTitulo
			$this->ServicioTitulo->ViewValue = $this->ServicioTitulo->CurrentValue;
			$this->ServicioTitulo->ViewCustomAttributes = "";

			// ServicioDondeRealizar
			$this->ServicioDondeRealizar->ViewValue = $this->ServicioDondeRealizar->CurrentValue;
			$this->ServicioDondeRealizar->ViewCustomAttributes = "";

			// ServicioRequisitos
			$this->ServicioRequisitos->ViewValue = $this->ServicioRequisitos->CurrentValue;
			$this->ServicioRequisitos->ViewCustomAttributes = "";

			// ServicioBeneficios
			$this->ServicioBeneficios->ViewValue = $this->ServicioBeneficios->CurrentValue;
			$this->ServicioBeneficios->ViewCustomAttributes = "";

			// ServicioProcedimiento
			$this->ServicioProcedimiento->ViewValue = $this->ServicioProcedimiento->CurrentValue;
			$this->ServicioProcedimiento->ViewCustomAttributes = "";

			// ServicioObservaciones
			$this->ServicioObservaciones->ViewValue = $this->ServicioObservaciones->CurrentValue;
			$this->ServicioObservaciones->ViewCustomAttributes = "";

			// ServicioActivo
			if (strval($this->ServicioActivo->CurrentValue) <> "") {
				$this->ServicioActivo->ViewValue = "";
				$arwrk = explode(",", strval($this->ServicioActivo->CurrentValue));
				$cnt = count($arwrk);
				for ($ari = 0; $ari < $cnt; $ari++) {
					switch (trim($arwrk[$ari])) {
						case $this->ServicioActivo->FldTagValue(1):
							$this->ServicioActivo->ViewValue .= $this->ServicioActivo->FldTagCaption(1) <> "" ? $this->ServicioActivo->FldTagCaption(1) : trim($arwrk[$ari]);
							break;
						default:
							$this->ServicioActivo->ViewValue .= trim($arwrk[$ari]);
					}
					if ($ari < $cnt-1) $this->ServicioActivo->ViewValue .= ew_ViewOptionSeparator($ari);
				}
			} else {
				$this->ServicioActivo->ViewValue = NULL;
			}
			$this->ServicioActivo->ViewCustomAttributes = "";

			// ServicioUrl
			$this->ServicioUrl->ViewValue = $this->ServicioUrl->CurrentValue;
			$this->ServicioUrl->ViewCustomAttributes = "";

			// ServicioOrden
			$this->ServicioOrden->LinkCustomAttributes = "";
			$this->ServicioOrden->HrefValue = "";
			$this->ServicioOrden->TooltipValue = "";

			// ServicioServicio
			$this->ServicioServicio->LinkCustomAttributes = "";
			$this->ServicioServicio->HrefValue = "";
			$this->ServicioServicio->TooltipValue = "";

			// ServicioSubTipo
			$this->ServicioSubTipo->LinkCustomAttributes = "";
			$this->ServicioSubTipo->HrefValue = "";
			$this->ServicioSubTipo->TooltipValue = "";

			// ServicioSubTipoDetalle
			$this->ServicioSubTipoDetalle->LinkCustomAttributes = "";
			$this->ServicioSubTipoDetalle->HrefValue = "";
			$this->ServicioSubTipoDetalle->TooltipValue = "";

			// ServicioTitulo
			$this->ServicioTitulo->LinkCustomAttributes = "";
			$this->ServicioTitulo->HrefValue = "";
			$this->ServicioTitulo->TooltipValue = "";

			// ServicioDondeRealizar
			$this->ServicioDondeRealizar->LinkCustomAttributes = "";
			$this->ServicioDondeRealizar->HrefValue = "";
			$this->ServicioDondeRealizar->TooltipValue = "";

			// ServicioRequisitos
			$this->ServicioRequisitos->LinkCustomAttributes = "";
			if (!empty($this->ServicioRequisitos->Upload->DbValue)) {
				$this->ServicioRequisitos->HrefValue = "serviciodetalle_ServicioRequisitos_bv.php?ServicioId=" . $this->ServicioId->CurrentValue;
				$this->ServicioRequisitos->LinkAttrs["target"] = "_blank";
				if ($this->Export <> "") $this->ServicioRequisitos->HrefValue = ew_ConvertFullUrl($this->ServicioRequisitos->HrefValue);
			} else {
				$this->ServicioRequisitos->HrefValue = "";
			}
			$this->ServicioRequisitos->TooltipValue = "";

			// ServicioBeneficios
			$this->ServicioBeneficios->LinkCustomAttributes = "";
			if (!empty($this->ServicioBeneficios->Upload->DbValue)) {
				$this->ServicioBeneficios->HrefValue = "serviciodetalle_ServicioBeneficios_bv.php?ServicioId=" . $this->ServicioId->CurrentValue;
				$this->ServicioBeneficios->LinkAttrs["target"] = "_blank";
				if ($this->Export <> "") $this->ServicioBeneficios->HrefValue = ew_ConvertFullUrl($this->ServicioBeneficios->HrefValue);
			} else {
				$this->ServicioBeneficios->HrefValue = "";
			}
			$this->ServicioBeneficios->TooltipValue = "";

			// ServicioProcedimiento
			$this->ServicioProcedimiento->LinkCustomAttributes = "";
			if (!empty($this->ServicioProcedimiento->Upload->DbValue)) {
				$this->ServicioProcedimiento->HrefValue = "serviciodetalle_ServicioProcedimiento_bv.php?ServicioId=" . $this->ServicioId->CurrentValue;
				$this->ServicioProcedimiento->LinkAttrs["target"] = "_blank";
				if ($this->Export <> "") $this->ServicioProcedimiento->HrefValue = ew_ConvertFullUrl($this->ServicioProcedimiento->HrefValue);
			} else {
				$this->ServicioProcedimiento->HrefValue = "";
			}
			$this->ServicioProcedimiento->TooltipValue = "";

			// ServicioObservaciones
			$this->ServicioObservaciones->LinkCustomAttributes = "";
			if (!empty($this->ServicioObservaciones->Upload->DbValue)) {
				$this->ServicioObservaciones->HrefValue = "serviciodetalle_ServicioObservaciones_bv.php?ServicioId=" . $this->ServicioId->CurrentValue;
				$this->ServicioObservaciones->LinkAttrs["target"] = "_blank";
				if ($this->Export <> "") $this->ServicioObservaciones->HrefValue = ew_ConvertFullUrl($this->ServicioObservaciones->HrefValue);
			} else {
				$this->ServicioObservaciones->HrefValue = "";
			}
			$this->ServicioObservaciones->TooltipValue = "";

			// ServicioActivo
			$this->ServicioActivo->LinkCustomAttributes = "";
			$this->ServicioActivo->HrefValue = "";
			$this->ServicioActivo->TooltipValue = "";

			// ServicioUrl
			$this->ServicioUrl->LinkCustomAttributes = "";
			$this->ServicioUrl->HrefValue = "";
			$this->ServicioUrl->TooltipValue = "";
		} elseif ($this->RowType == EW_ROWTYPE_ADD) { // Add row

			// ServicioOrden
			$this->ServicioOrden->EditCustomAttributes = "";
			$this->ServicioOrden->EditValue = ew_HtmlEncode($this->ServicioOrden->CurrentValue);
			$this->ServicioOrden->PlaceHolder = ew_RemoveHtml($this->ServicioOrden->FldCaption());

			// ServicioServicio
			$this->ServicioServicio->EditCustomAttributes = "";
			if (trim(strval($this->ServicioServicio->CurrentValue)) == "") {
				$sFilterWrk = "0=1";
			} else {
				$sFilterWrk = "`ServicioId`" . ew_SearchString("=", $this->ServicioServicio->CurrentValue, EW_DATATYPE_NUMBER);
			}
			$sSqlWrk = "SELECT `ServicioId`, `ServicioNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld`, '' AS `SelectFilterFld`, '' AS `SelectFilterFld2`, '' AS `SelectFilterFld3`, '' AS `SelectFilterFld4` FROM `servicios`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				ew_AddFilter($sWhereWrk, $sFilterWrk);
			}

			// Call Lookup selecting
			$this->Lookup_Selecting($this->ServicioServicio, $sWhereWrk);
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$rswrk = $conn->Execute($sSqlWrk);
			$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
			if ($rswrk) $rswrk->Close();
			array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect"), "", "", "", "", "", "", ""));
			$this->ServicioServicio->EditValue = $arwrk;

			// ServicioSubTipo
			$this->ServicioSubTipo->EditCustomAttributes = "";
			if (trim(strval($this->ServicioSubTipo->CurrentValue)) == "") {
				$sFilterWrk = "0=1";
			} else {
				$sFilterWrk = "`SubTipoId`" . ew_SearchString("=", $this->ServicioSubTipo->CurrentValue, EW_DATATYPE_NUMBER);
			}
			$sSqlWrk = "SELECT `SubTipoId`, `SubTipoNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld`, `SubtipoServicio` AS `SelectFilterFld`, '' AS `SelectFilterFld2`, '' AS `SelectFilterFld3`, '' AS `SelectFilterFld4` FROM `subtiposervicios`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				ew_AddFilter($sWhereWrk, $sFilterWrk);
			}

			// Call Lookup selecting
			$this->Lookup_Selecting($this->ServicioSubTipo, $sWhereWrk);
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$rswrk = $conn->Execute($sSqlWrk);
			$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
			if ($rswrk) $rswrk->Close();
			array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect"), "", "", "", "", "", "", ""));
			$this->ServicioSubTipo->EditValue = $arwrk;

			// ServicioSubTipoDetalle
			$this->ServicioSubTipoDetalle->EditCustomAttributes = "";
			$sFilterWrk = "";
			$sSqlWrk = "SELECT `SubTipoDetalleId`, `SubTipoNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld`, `SubtTipoDetalleTipo` AS `SelectFilterFld`, '' AS `SelectFilterFld2`, '' AS `SelectFilterFld3`, '' AS `SelectFilterFld4` FROM `subtipodetalles`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				ew_AddFilter($sWhereWrk, $sFilterWrk);
			}

			// Call Lookup selecting
			$this->Lookup_Selecting($this->ServicioSubTipoDetalle, $sWhereWrk);
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$rswrk = $conn->Execute($sSqlWrk);
			$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
			if ($rswrk) $rswrk->Close();
			array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect"), "", "", "", "", "", "", ""));
			$this->ServicioSubTipoDetalle->EditValue = $arwrk;

			// ServicioTitulo
			$this->ServicioTitulo->EditCustomAttributes = "";
			$this->ServicioTitulo->EditValue = ew_HtmlEncode($this->ServicioTitulo->CurrentValue);
			$this->ServicioTitulo->PlaceHolder = ew_RemoveHtml($this->ServicioTitulo->FldCaption());

			// ServicioDondeRealizar
			$this->ServicioDondeRealizar->EditCustomAttributes = "";
			$this->ServicioDondeRealizar->EditValue = ew_HtmlEncode($this->ServicioDondeRealizar->CurrentValue);
			$this->ServicioDondeRealizar->PlaceHolder = ew_RemoveHtml($this->ServicioDondeRealizar->FldCaption());

			// ServicioRequisitos
			$this->ServicioRequisitos->EditCustomAttributes = "";
			$this->ServicioRequisitos->EditValue = $this->ServicioRequisitos->CurrentValue;
			$this->ServicioRequisitos->PlaceHolder = ew_RemoveHtml($this->ServicioRequisitos->FldCaption());

			// ServicioBeneficios
			$this->ServicioBeneficios->EditCustomAttributes = "";
			$this->ServicioBeneficios->EditValue = $this->ServicioBeneficios->CurrentValue;
			$this->ServicioBeneficios->PlaceHolder = ew_RemoveHtml($this->ServicioBeneficios->FldCaption());

			// ServicioProcedimiento
			$this->ServicioProcedimiento->EditCustomAttributes = "";
			$this->ServicioProcedimiento->EditValue = $this->ServicioProcedimiento->CurrentValue;
			$this->ServicioProcedimiento->PlaceHolder = ew_RemoveHtml($this->ServicioProcedimiento->FldCaption());

			// ServicioObservaciones
			$this->ServicioObservaciones->EditCustomAttributes = "";
			$this->ServicioObservaciones->EditValue = $this->ServicioObservaciones->CurrentValue;
			$this->ServicioObservaciones->PlaceHolder = ew_RemoveHtml($this->ServicioObservaciones->FldCaption());

			// ServicioActivo
			$this->ServicioActivo->EditCustomAttributes = "";
			$arwrk = array();
			$arwrk[] = array($this->ServicioActivo->FldTagValue(1), $this->ServicioActivo->FldTagCaption(1) <> "" ? $this->ServicioActivo->FldTagCaption(1) : $this->ServicioActivo->FldTagValue(1));
			$this->ServicioActivo->EditValue = $arwrk;

			// ServicioUrl
			$this->ServicioUrl->EditCustomAttributes = "";
			$this->ServicioUrl->EditValue = ew_HtmlEncode($this->ServicioUrl->CurrentValue);
			$this->ServicioUrl->PlaceHolder = ew_RemoveHtml($this->ServicioUrl->FldCaption());

			// Edit refer script
			// ServicioOrden

			$this->ServicioOrden->HrefValue = "";

			// ServicioServicio
			$this->ServicioServicio->HrefValue = "";

			// ServicioSubTipo
			$this->ServicioSubTipo->HrefValue = "";

			// ServicioSubTipoDetalle
			$this->ServicioSubTipoDetalle->HrefValue = "";

			// ServicioTitulo
			$this->ServicioTitulo->HrefValue = "";

			// ServicioDondeRealizar
			$this->ServicioDondeRealizar->HrefValue = "";

			// ServicioRequisitos
			if (!empty($this->ServicioRequisitos->Upload->DbValue)) {
				$this->ServicioRequisitos->HrefValue = "serviciodetalle_ServicioRequisitos_bv.php?ServicioId=" . $this->ServicioId->CurrentValue;
				$this->ServicioRequisitos->LinkAttrs["target"] = "_blank";
				if ($this->Export <> "") $this->ServicioRequisitos->HrefValue = ew_ConvertFullUrl($this->ServicioRequisitos->HrefValue);
			} else {
				$this->ServicioRequisitos->HrefValue = "";
			}

			// ServicioBeneficios
			if (!empty($this->ServicioBeneficios->Upload->DbValue)) {
				$this->ServicioBeneficios->HrefValue = "serviciodetalle_ServicioBeneficios_bv.php?ServicioId=" . $this->ServicioId->CurrentValue;
				$this->ServicioBeneficios->LinkAttrs["target"] = "_blank";
				if ($this->Export <> "") $this->ServicioBeneficios->HrefValue = ew_ConvertFullUrl($this->ServicioBeneficios->HrefValue);
			} else {
				$this->ServicioBeneficios->HrefValue = "";
			}

			// ServicioProcedimiento
			if (!empty($this->ServicioProcedimiento->Upload->DbValue)) {
				$this->ServicioProcedimiento->HrefValue = "serviciodetalle_ServicioProcedimiento_bv.php?ServicioId=" . $this->ServicioId->CurrentValue;
				$this->ServicioProcedimiento->LinkAttrs["target"] = "_blank";
				if ($this->Export <> "") $this->ServicioProcedimiento->HrefValue = ew_ConvertFullUrl($this->ServicioProcedimiento->HrefValue);
			} else {
				$this->ServicioProcedimiento->HrefValue = "";
			}

			// ServicioObservaciones
			if (!empty($this->ServicioObservaciones->Upload->DbValue)) {
				$this->ServicioObservaciones->HrefValue = "serviciodetalle_ServicioObservaciones_bv.php?ServicioId=" . $this->ServicioId->CurrentValue;
				$this->ServicioObservaciones->LinkAttrs["target"] = "_blank";
				if ($this->Export <> "") $this->ServicioObservaciones->HrefValue = ew_ConvertFullUrl($this->ServicioObservaciones->HrefValue);
			} else {
				$this->ServicioObservaciones->HrefValue = "";
			}

			// ServicioActivo
			$this->ServicioActivo->HrefValue = "";

			// ServicioUrl
			$this->ServicioUrl->HrefValue = "";
		}
		if ($this->RowType == EW_ROWTYPE_ADD ||
			$this->RowType == EW_ROWTYPE_EDIT ||
			$this->RowType == EW_ROWTYPE_SEARCH) { // Add / Edit / Search row
			$this->SetupFieldTitles();
		}

		// Call Row Rendered event
		if ($this->RowType <> EW_ROWTYPE_AGGREGATEINIT)
			$this->Row_Rendered();
	}

	// Validate form
	function ValidateForm() {
		global $Language, $gsFormError;

		// Initialize form error message
		$gsFormError = "";

		// Check if validation required
		if (!EW_SERVER_VALIDATE)
			return ($gsFormError == "");
		if (!ew_CheckInteger($this->ServicioOrden->FormValue)) {
			ew_AddMessage($gsFormError, $this->ServicioOrden->FldErrMsg());
		}

		// Return validate result
		$ValidateForm = ($gsFormError == "");

		// Call Form_CustomValidate event
		$sFormCustomError = "";
		$ValidateForm = $ValidateForm && $this->Form_CustomValidate($sFormCustomError);
		if ($sFormCustomError <> "") {
			ew_AddMessage($gsFormError, $sFormCustomError);
		}
		return $ValidateForm;
	}

	// Add record
	function AddRow($rsold = NULL) {
		global $conn, $Language, $Security;

		// Load db values from rsold
		if ($rsold) {
			$this->LoadDbValues($rsold);
		}
		$rsnew = array();

		// ServicioOrden
		$this->ServicioOrden->SetDbValueDef($rsnew, $this->ServicioOrden->CurrentValue, NULL, FALSE);

		// ServicioServicio
		$this->ServicioServicio->SetDbValueDef($rsnew, $this->ServicioServicio->CurrentValue, NULL, FALSE);

		// ServicioSubTipo
		$this->ServicioSubTipo->SetDbValueDef($rsnew, $this->ServicioSubTipo->CurrentValue, NULL, FALSE);

		// ServicioSubTipoDetalle
		$this->ServicioSubTipoDetalle->SetDbValueDef($rsnew, $this->ServicioSubTipoDetalle->CurrentValue, NULL, FALSE);

		// ServicioTitulo
		$this->ServicioTitulo->SetDbValueDef($rsnew, $this->ServicioTitulo->CurrentValue, NULL, FALSE);

		// ServicioDondeRealizar
		$this->ServicioDondeRealizar->SetDbValueDef($rsnew, $this->ServicioDondeRealizar->CurrentValue, NULL, FALSE);

		// ServicioRequisitos
		$this->ServicioRequisitos->SetDbValueDef($rsnew, $this->ServicioRequisitos->CurrentValue, NULL, FALSE);

		// ServicioBeneficios
		$this->ServicioBeneficios->SetDbValueDef($rsnew, $this->ServicioBeneficios->CurrentValue, NULL, FALSE);

		// ServicioProcedimiento
		$this->ServicioProcedimiento->SetDbValueDef($rsnew, $this->ServicioProcedimiento->CurrentValue, NULL, FALSE);

		// ServicioObservaciones
		$this->ServicioObservaciones->SetDbValueDef($rsnew, $this->ServicioObservaciones->CurrentValue, NULL, FALSE);

		// ServicioActivo
		$this->ServicioActivo->SetDbValueDef($rsnew, $this->ServicioActivo->CurrentValue, NULL, FALSE);

		// ServicioUrl
		$this->ServicioUrl->SetDbValueDef($rsnew, $this->ServicioUrl->CurrentValue, NULL, FALSE);

		// Call Row Inserting event
		$rs = ($rsold == NULL) ? NULL : $rsold->fields;
		$bInsertRow = $this->Row_Inserting($rs, $rsnew);
		if ($bInsertRow) {
			$conn->raiseErrorFn = 'ew_ErrorFn';
			$AddRow = $this->Insert($rsnew);
			$conn->raiseErrorFn = '';
			if ($AddRow) {
			}
		} else {
			if ($this->getSuccessMessage() <> "" || $this->getFailureMessage() <> "") {

				// Use the message, do nothing
			} elseif ($this->CancelMessage <> "") {
				$this->setFailureMessage($this->CancelMessage);
				$this->CancelMessage = "";
			} else {
				$this->setFailureMessage($Language->Phrase("InsertCancelled"));
			}
			$AddRow = FALSE;
		}

		// Get insert id if necessary
		if ($AddRow) {
			$this->ServicioId->setDbValue($conn->Insert_ID());
			$rsnew['ServicioId'] = $this->ServicioId->DbValue;
		}
		if ($AddRow) {

			// Call Row Inserted event
			$rs = ($rsold == NULL) ? NULL : $rsold->fields;
			$this->Row_Inserted($rs, $rsnew);
		}
		return $AddRow;
	}

	// Set up Breadcrumb
	function SetupBreadcrumb() {
		global $Breadcrumb, $Language;
		$Breadcrumb = new cBreadcrumb();
		$Breadcrumb->Add("list", $this->TableVar, "serviciodetallelist.php", $this->TableVar, TRUE);
		$PageId = ($this->CurrentAction == "C") ? "Copy" : "Add";
		$Breadcrumb->Add("add", $PageId, ew_CurrentUrl());
	}

	// Page Load event
	function Page_Load() {

		//echo "Page Load";
	}

	// Page Unload event
	function Page_Unload() {

		//echo "Page Unload";
	}

	// Page Redirecting event
	function Page_Redirecting(&$url) {

		// Example:
		//$url = "your URL";

	}

	// Message Showing event
	// $type = ''|'success'|'failure'|'warning'
	function Message_Showing(&$msg, $type) {
		if ($type == 'success') {

			//$msg = "your success message";
		} elseif ($type == 'failure') {

			//$msg = "your failure message";
		} elseif ($type == 'warning') {

			//$msg = "your warning message";
		} else {

			//$msg = "your message";
		}
	}

	// Page Render event
	function Page_Render() {

		//echo "Page Render";
	}

	// Page Data Rendering event
	function Page_DataRendering(&$header) {

		// Example:
		//$header = "your header";

	}

	// Page Data Rendered event
	function Page_DataRendered(&$footer) {

		// Example:
		//$footer = "your footer";

	}

	// Form Custom Validate event
	function Form_CustomValidate(&$CustomError) {

		// Return error message in CustomError
		return TRUE;
	}
}
?>
<?php ew_Header(FALSE) ?>
<?php

// Create page object
if (!isset($serviciodetalle_add)) $serviciodetalle_add = new cserviciodetalle_add();

// Page init
$serviciodetalle_add->Page_Init();

// Page main
$serviciodetalle_add->Page_Main();

// Global Page Rendering event (in userfn*.php)
Page_Rendering();

// Page Rendering event
$serviciodetalle_add->Page_Render();
?>
<?php include_once "header.php" ?>
<script type="text/javascript">

// Page object
var serviciodetalle_add = new ew_Page("serviciodetalle_add");
serviciodetalle_add.PageID = "add"; // Page ID
var EW_PAGE_ID = serviciodetalle_add.PageID; // For backward compatibility

// Form object
var fserviciodetalleadd = new ew_Form("fserviciodetalleadd");

// Validate form
fserviciodetalleadd.Validate = function() {
	if (!this.ValidateRequired)
		return true; // Ignore validation
	var $ = jQuery, fobj = this.GetForm(), $fobj = $(fobj);
	this.PostAutoSuggest();
	if ($fobj.find("#a_confirm").val() == "F")
		return true;
	var elm, felm, uelm, addcnt = 0;
	var $k = $fobj.find("#" + this.FormKeyCountName); // Get key_count
	var rowcnt = ($k[0]) ? parseInt($k.val(), 10) : 1;
	var startcnt = (rowcnt == 0) ? 0 : 1; // Check rowcnt == 0 => Inline-Add
	var gridinsert = $fobj.find("#a_list").val() == "gridinsert";
	for (var i = startcnt; i <= rowcnt; i++) {
		var infix = ($k[0]) ? String(i) : "";
		$fobj.data("rowindex", infix);
			elm = this.GetElements("x" + infix + "_ServicioOrden");
			if (elm && !ew_CheckInteger(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($serviciodetalle->ServicioOrden->FldErrMsg()) ?>");

			// Set up row object
			ew_ElementsToRow(fobj);

			// Fire Form_CustomValidate event
			if (!this.Form_CustomValidate(fobj))
				return false;
	}

	// Process detail forms
	var dfs = $fobj.find("input[name='detailpage']").get();
	for (var i = 0; i < dfs.length; i++) {
		var df = dfs[i], val = df.value;
		if (val && ewForms[val])
			if (!ewForms[val].Validate())
				return false;
	}
	return true;
}

// Form_CustomValidate event
fserviciodetalleadd.Form_CustomValidate = 
 function(fobj) { // DO NOT CHANGE THIS LINE!

 	// Your custom validation code here, return false if invalid. 
 	return true;
 }

// Use JavaScript validation or not
<?php if (EW_CLIENT_VALIDATE) { ?>
fserviciodetalleadd.ValidateRequired = true;
<?php } else { ?>
fserviciodetalleadd.ValidateRequired = false; 
<?php } ?>

// Dynamic selection lists
fserviciodetalleadd.Lists["x_ServicioServicio"] = {"LinkField":"x_ServicioId","Ajax":true,"AutoFill":false,"DisplayFields":["x_ServicioNombre","","",""],"ParentFields":[],"FilterFields":[],"Options":[]};
fserviciodetalleadd.Lists["x_ServicioSubTipo"] = {"LinkField":"x_SubTipoId","Ajax":true,"AutoFill":false,"DisplayFields":["x_SubTipoNombre","","",""],"ParentFields":["x_ServicioServicio"],"FilterFields":["x_SubtipoServicio"],"Options":[]};
fserviciodetalleadd.Lists["x_ServicioSubTipoDetalle"] = {"LinkField":"x_SubTipoDetalleId","Ajax":null,"AutoFill":false,"DisplayFields":["x_SubTipoNombre","","",""],"ParentFields":["x_ServicioSubTipo"],"FilterFields":["x_SubtTipoDetalleTipo"],"Options":[]};

// Form object for search
</script>
<script type="text/javascript">

// Write your client script here, no need to add script tags.
</script>
<?php $Breadcrumb->Render(); ?>
<?php $serviciodetalle_add->ShowPageHeader(); ?>
<?php
$serviciodetalle_add->ShowMessage();
?>
<form name="fserviciodetalleadd" id="fserviciodetalleadd" class="ewForm form-inline" action="<?php echo ew_CurrentPage() ?>" method="post">
<input type="hidden" name="t" value="serviciodetalle">
<input type="hidden" name="a_add" id="a_add" value="A">
<table class="ewGrid"><tr><td>
<table id="tbl_serviciodetalleadd" class="table table-bordered table-striped">
<?php if ($serviciodetalle->ServicioOrden->Visible) { // ServicioOrden ?>
	<tr id="r_ServicioOrden">
		<td><span id="elh_serviciodetalle_ServicioOrden"><?php echo $serviciodetalle->ServicioOrden->FldCaption() ?></span></td>
		<td<?php echo $serviciodetalle->ServicioOrden->CellAttributes() ?>>
<span id="el_serviciodetalle_ServicioOrden" class="control-group">
<input type="text" data-field="x_ServicioOrden" name="x_ServicioOrden" id="x_ServicioOrden" size="5" placeholder="<?php echo ew_HtmlEncode($serviciodetalle->ServicioOrden->PlaceHolder) ?>" value="<?php echo $serviciodetalle->ServicioOrden->EditValue ?>"<?php echo $serviciodetalle->ServicioOrden->EditAttributes() ?>>
</span>
<?php echo $serviciodetalle->ServicioOrden->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($serviciodetalle->ServicioServicio->Visible) { // ServicioServicio ?>
	<tr id="r_ServicioServicio">
		<td><span id="elh_serviciodetalle_ServicioServicio"><?php echo $serviciodetalle->ServicioServicio->FldCaption() ?></span></td>
		<td<?php echo $serviciodetalle->ServicioServicio->CellAttributes() ?>>
<span id="el_serviciodetalle_ServicioServicio" class="control-group">
<?php $serviciodetalle->ServicioServicio->EditAttrs["onchange"] = "ew_UpdateOpt.call(this, ['x_ServicioSubTipo']); " . @$serviciodetalle->ServicioServicio->EditAttrs["onchange"]; ?>
<select data-field="x_ServicioServicio" id="x_ServicioServicio" name="x_ServicioServicio"<?php echo $serviciodetalle->ServicioServicio->EditAttributes() ?>>
<?php
if (is_array($serviciodetalle->ServicioServicio->EditValue)) {
	$arwrk = $serviciodetalle->ServicioServicio->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($serviciodetalle->ServicioServicio->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
?>
</select>
<?php if (AllowAdd(CurrentProjectID() . "servicios")) { ?>
&nbsp;<a id="aol_x_ServicioServicio" class="ewAddOptLink" href="javascript:void(0);" onclick="ew_AddOptDialogShow({lnk:this,el:'x_ServicioServicio',url:'serviciosaddopt.php'});"><?php echo $Language->Phrase("AddLink") ?>&nbsp;<?php echo $serviciodetalle->ServicioServicio->FldCaption() ?></a>
<?php } ?>
<?php
$sSqlWrk = "SELECT `ServicioId`, `ServicioNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `servicios`";
$sWhereWrk = "";

// Call Lookup selecting
$serviciodetalle->Lookup_Selecting($serviciodetalle->ServicioServicio, $sWhereWrk);
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
?>
<input type="hidden" name="s_x_ServicioServicio" id="s_x_ServicioServicio" value="s=<?php echo ew_Encrypt($sSqlWrk) ?>&amp;f0=<?php echo ew_Encrypt("`ServicioId` = {filter_value}"); ?>&amp;t0=3">
</span>
<?php echo $serviciodetalle->ServicioServicio->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($serviciodetalle->ServicioSubTipo->Visible) { // ServicioSubTipo ?>
	<tr id="r_ServicioSubTipo">
		<td><span id="elh_serviciodetalle_ServicioSubTipo"><?php echo $serviciodetalle->ServicioSubTipo->FldCaption() ?></span></td>
		<td<?php echo $serviciodetalle->ServicioSubTipo->CellAttributes() ?>>
<span id="el_serviciodetalle_ServicioSubTipo" class="control-group">
<?php $serviciodetalle->ServicioSubTipo->EditAttrs["onchange"] = "ew_UpdateOpt.call(this, ['x_ServicioSubTipoDetalle']); " . @$serviciodetalle->ServicioSubTipo->EditAttrs["onchange"]; ?>
<select data-field="x_ServicioSubTipo" id="x_ServicioSubTipo" name="x_ServicioSubTipo"<?php echo $serviciodetalle->ServicioSubTipo->EditAttributes() ?>>
<?php
if (is_array($serviciodetalle->ServicioSubTipo->EditValue)) {
	$arwrk = $serviciodetalle->ServicioSubTipo->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($serviciodetalle->ServicioSubTipo->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
?>
</select>
<?php if (AllowAdd(CurrentProjectID() . "subtiposervicios")) { ?>
&nbsp;<a id="aol_x_ServicioSubTipo" class="ewAddOptLink" href="javascript:void(0);" onclick="ew_AddOptDialogShow({lnk:this,el:'x_ServicioSubTipo',url:'subtiposerviciosaddopt.php'});"><?php echo $Language->Phrase("AddLink") ?>&nbsp;<?php echo $serviciodetalle->ServicioSubTipo->FldCaption() ?></a>
<?php } ?>
<?php
$sSqlWrk = "SELECT `SubTipoId`, `SubTipoNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `subtiposervicios`";
$sWhereWrk = "{filter}";

// Call Lookup selecting
$serviciodetalle->Lookup_Selecting($serviciodetalle->ServicioSubTipo, $sWhereWrk);
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
?>
<input type="hidden" name="s_x_ServicioSubTipo" id="s_x_ServicioSubTipo" value="s=<?php echo ew_Encrypt($sSqlWrk) ?>&amp;f0=<?php echo ew_Encrypt("`SubTipoId` = {filter_value}"); ?>&amp;t0=3&amp;f1=<?php echo ew_Encrypt("`SubtipoServicio` IN ({filter_value})"); ?>&amp;t1=3">
</span>
<?php echo $serviciodetalle->ServicioSubTipo->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($serviciodetalle->ServicioSubTipoDetalle->Visible) { // ServicioSubTipoDetalle ?>
	<tr id="r_ServicioSubTipoDetalle">
		<td><span id="elh_serviciodetalle_ServicioSubTipoDetalle"><?php echo $serviciodetalle->ServicioSubTipoDetalle->FldCaption() ?></span></td>
		<td<?php echo $serviciodetalle->ServicioSubTipoDetalle->CellAttributes() ?>>
<span id="el_serviciodetalle_ServicioSubTipoDetalle" class="control-group">
<select data-field="x_ServicioSubTipoDetalle" id="x_ServicioSubTipoDetalle" name="x_ServicioSubTipoDetalle"<?php echo $serviciodetalle->ServicioSubTipoDetalle->EditAttributes() ?>>
<?php
if (is_array($serviciodetalle->ServicioSubTipoDetalle->EditValue)) {
	$arwrk = $serviciodetalle->ServicioSubTipoDetalle->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($serviciodetalle->ServicioSubTipoDetalle->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
?>
</select>
<?php if (AllowAdd(CurrentProjectID() . "subtipodetalles")) { ?>
&nbsp;<a id="aol_x_ServicioSubTipoDetalle" class="ewAddOptLink" href="javascript:void(0);" onclick="ew_AddOptDialogShow({lnk:this,el:'x_ServicioSubTipoDetalle',url:'subtipodetallesaddopt.php'});"><?php echo $Language->Phrase("AddLink") ?>&nbsp;<?php echo $serviciodetalle->ServicioSubTipoDetalle->FldCaption() ?></a>
<?php } ?>
<script type="text/javascript">
fserviciodetalleadd.Lists["x_ServicioSubTipoDetalle"].Options = <?php echo (is_array($serviciodetalle->ServicioSubTipoDetalle->EditValue)) ? ew_ArrayToJson($serviciodetalle->ServicioSubTipoDetalle->EditValue, 1) : "[]" ?>;
</script>
</span>
<?php echo $serviciodetalle->ServicioSubTipoDetalle->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($serviciodetalle->ServicioTitulo->Visible) { // ServicioTitulo ?>
	<tr id="r_ServicioTitulo">
		<td><span id="elh_serviciodetalle_ServicioTitulo"><?php echo $serviciodetalle->ServicioTitulo->FldCaption() ?></span></td>
		<td<?php echo $serviciodetalle->ServicioTitulo->CellAttributes() ?>>
<span id="el_serviciodetalle_ServicioTitulo" class="control-group">
<input type="text" data-field="x_ServicioTitulo" name="x_ServicioTitulo" id="x_ServicioTitulo" size="150" maxlength="180" placeholder="<?php echo ew_HtmlEncode($serviciodetalle->ServicioTitulo->PlaceHolder) ?>" value="<?php echo $serviciodetalle->ServicioTitulo->EditValue ?>"<?php echo $serviciodetalle->ServicioTitulo->EditAttributes() ?>>
</span>
<?php echo $serviciodetalle->ServicioTitulo->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($serviciodetalle->ServicioDondeRealizar->Visible) { // ServicioDondeRealizar ?>
	<tr id="r_ServicioDondeRealizar">
		<td><span id="elh_serviciodetalle_ServicioDondeRealizar"><?php echo $serviciodetalle->ServicioDondeRealizar->FldCaption() ?></span></td>
		<td<?php echo $serviciodetalle->ServicioDondeRealizar->CellAttributes() ?>>
<span id="el_serviciodetalle_ServicioDondeRealizar" class="control-group">
<input type="text" data-field="x_ServicioDondeRealizar" name="x_ServicioDondeRealizar" id="x_ServicioDondeRealizar" size="30" maxlength="255" placeholder="<?php echo ew_HtmlEncode($serviciodetalle->ServicioDondeRealizar->PlaceHolder) ?>" value="<?php echo $serviciodetalle->ServicioDondeRealizar->EditValue ?>"<?php echo $serviciodetalle->ServicioDondeRealizar->EditAttributes() ?>>
</span>
<?php echo $serviciodetalle->ServicioDondeRealizar->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($serviciodetalle->ServicioRequisitos->Visible) { // ServicioRequisitos ?>
	<tr id="r_ServicioRequisitos">
		<td><span id="elh_serviciodetalle_ServicioRequisitos"><?php echo $serviciodetalle->ServicioRequisitos->FldCaption() ?></span></td>
		<td<?php echo $serviciodetalle->ServicioRequisitos->CellAttributes() ?>>
<span id="el_serviciodetalle_ServicioRequisitos" class="control-group">
<textarea data-field="x_ServicioRequisitos" class="editor" name="x_ServicioRequisitos" id="x_ServicioRequisitos" cols="4" rows="35" placeholder="<?php echo ew_HtmlEncode($serviciodetalle->ServicioRequisitos->PlaceHolder) ?>"<?php echo $serviciodetalle->ServicioRequisitos->EditAttributes() ?>><?php echo $serviciodetalle->ServicioRequisitos->EditValue ?></textarea>
<script type="text/javascript">
ew_CreateEditor("fserviciodetalleadd", "x_ServicioRequisitos", 0, 0, <?php echo ($serviciodetalle->ServicioRequisitos->ReadOnly || FALSE) ? "true" : "false" ?>);
</script>
</span>
<?php echo $serviciodetalle->ServicioRequisitos->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($serviciodetalle->ServicioBeneficios->Visible) { // ServicioBeneficios ?>
	<tr id="r_ServicioBeneficios">
		<td><span id="elh_serviciodetalle_ServicioBeneficios"><?php echo $serviciodetalle->ServicioBeneficios->FldCaption() ?></span></td>
		<td<?php echo $serviciodetalle->ServicioBeneficios->CellAttributes() ?>>
<span id="el_serviciodetalle_ServicioBeneficios" class="control-group">
<textarea data-field="x_ServicioBeneficios" class="editor" name="x_ServicioBeneficios" id="x_ServicioBeneficios" cols="4" rows="35" placeholder="<?php echo ew_HtmlEncode($serviciodetalle->ServicioBeneficios->PlaceHolder) ?>"<?php echo $serviciodetalle->ServicioBeneficios->EditAttributes() ?>><?php echo $serviciodetalle->ServicioBeneficios->EditValue ?></textarea>
<script type="text/javascript">
ew_CreateEditor("fserviciodetalleadd", "x_ServicioBeneficios", 0, 0, <?php echo ($serviciodetalle->ServicioBeneficios->ReadOnly || FALSE) ? "true" : "false" ?>);
</script>
</span>
<?php echo $serviciodetalle->ServicioBeneficios->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($serviciodetalle->ServicioProcedimiento->Visible) { // ServicioProcedimiento ?>
	<tr id="r_ServicioProcedimiento">
		<td><span id="elh_serviciodetalle_ServicioProcedimiento"><?php echo $serviciodetalle->ServicioProcedimiento->FldCaption() ?></span></td>
		<td<?php echo $serviciodetalle->ServicioProcedimiento->CellAttributes() ?>>
<span id="el_serviciodetalle_ServicioProcedimiento" class="control-group">
<textarea data-field="x_ServicioProcedimiento" class="editor" name="x_ServicioProcedimiento" id="x_ServicioProcedimiento" cols="4" rows="35" placeholder="<?php echo ew_HtmlEncode($serviciodetalle->ServicioProcedimiento->PlaceHolder) ?>"<?php echo $serviciodetalle->ServicioProcedimiento->EditAttributes() ?>><?php echo $serviciodetalle->ServicioProcedimiento->EditValue ?></textarea>
<script type="text/javascript">
ew_CreateEditor("fserviciodetalleadd", "x_ServicioProcedimiento", 0, 0, <?php echo ($serviciodetalle->ServicioProcedimiento->ReadOnly || FALSE) ? "true" : "false" ?>);
</script>
</span>
<?php echo $serviciodetalle->ServicioProcedimiento->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($serviciodetalle->ServicioObservaciones->Visible) { // ServicioObservaciones ?>
	<tr id="r_ServicioObservaciones">
		<td><span id="elh_serviciodetalle_ServicioObservaciones"><?php echo $serviciodetalle->ServicioObservaciones->FldCaption() ?></span></td>
		<td<?php echo $serviciodetalle->ServicioObservaciones->CellAttributes() ?>>
<span id="el_serviciodetalle_ServicioObservaciones" class="control-group">
<textarea data-field="x_ServicioObservaciones" class="editor" name="x_ServicioObservaciones" id="x_ServicioObservaciones" cols="4" rows="35" placeholder="<?php echo ew_HtmlEncode($serviciodetalle->ServicioObservaciones->PlaceHolder) ?>"<?php echo $serviciodetalle->ServicioObservaciones->EditAttributes() ?>><?php echo $serviciodetalle->ServicioObservaciones->EditValue ?></textarea>
<script type="text/javascript">
ew_CreateEditor("fserviciodetalleadd", "x_ServicioObservaciones", 0, 0, <?php echo ($serviciodetalle->ServicioObservaciones->ReadOnly || FALSE) ? "true" : "false" ?>);
</script>
</span>
<?php echo $serviciodetalle->ServicioObservaciones->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($serviciodetalle->ServicioActivo->Visible) { // ServicioActivo ?>
	<tr id="r_ServicioActivo">
		<td><span id="elh_serviciodetalle_ServicioActivo"><?php echo $serviciodetalle->ServicioActivo->FldCaption() ?></span></td>
		<td<?php echo $serviciodetalle->ServicioActivo->CellAttributes() ?>>
<span id="el_serviciodetalle_ServicioActivo" class="control-group">
<div id="tp_x_ServicioActivo" class="<?php echo EW_ITEM_TEMPLATE_CLASSNAME; ?>"><input type="checkbox" name="x_ServicioActivo[]" id="x_ServicioActivo[]" value="{value}"<?php echo $serviciodetalle->ServicioActivo->EditAttributes() ?>></div>
<div id="dsl_x_ServicioActivo" data-repeatcolumn="5" class="ewItemList">
<?php
$arwrk = $serviciodetalle->ServicioActivo->EditValue;
if (is_array($arwrk)) {
	$armultiwrk= explode(",", strval($serviciodetalle->ServicioActivo->CurrentValue));
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = "";
		$cnt = count($armultiwrk);
		for ($ari = 0; $ari < $cnt; $ari++) {
			if (strval($arwrk[$rowcntwrk][0]) == trim(strval($armultiwrk[$ari]))) {
				$selwrk = " checked=\"checked\"";
				if ($selwrk <> "") $emptywrk = FALSE;
				break;
			}
		}

		// Note: No spacing within the LABEL tag
?>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 1) ?>
<label class="checkbox"><input type="checkbox" data-field="x_ServicioActivo" name="x_ServicioActivo[]" id="x_ServicioActivo_<?php echo $rowcntwrk ?>[]" value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?><?php echo $serviciodetalle->ServicioActivo->EditAttributes() ?>><?php echo $arwrk[$rowcntwrk][1] ?></label>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 2) ?>
<?php
	}
}
?>
</div>
</span>
<?php echo $serviciodetalle->ServicioActivo->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($serviciodetalle->ServicioUrl->Visible) { // ServicioUrl ?>
	<tr id="r_ServicioUrl">
		<td><span id="elh_serviciodetalle_ServicioUrl"><?php echo $serviciodetalle->ServicioUrl->FldCaption() ?></span></td>
		<td<?php echo $serviciodetalle->ServicioUrl->CellAttributes() ?>>
<span id="el_serviciodetalle_ServicioUrl" class="control-group">
<input type="text" data-field="x_ServicioUrl" name="x_ServicioUrl" id="x_ServicioUrl" size="30" maxlength="180" placeholder="<?php echo ew_HtmlEncode($serviciodetalle->ServicioUrl->PlaceHolder) ?>" value="<?php echo $serviciodetalle->ServicioUrl->EditValue ?>"<?php echo $serviciodetalle->ServicioUrl->EditAttributes() ?>>
</span>
<?php echo $serviciodetalle->ServicioUrl->CustomMsg ?></td>
	</tr>
<?php } ?>
</table>
</td></tr></table>
<button class="btn btn-primary ewButton" name="btnAction" id="btnAction" type="submit"><?php echo $Language->Phrase("AddBtn") ?></button>
</form>
<script type="text/javascript">
fserviciodetalleadd.Init();
<?php if (EW_MOBILE_REFLOW && ew_IsMobile()) { ?>
ew_Reflow();
<?php } ?>
</script>
<?php
$serviciodetalle_add->ShowPageFooter();
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
?>
<script type="text/javascript">

// Write your table-specific startup script here
// document.write("page loaded");

</script>
<?php include_once "footer.php" ?>
<?php
$serviciodetalle_add->Page_Terminate();
?>
